#!/usr/bin/python
#-*-coding:utf-8-*-


import time
import os


def func(ip_address):
    cmds = 'ping -c 3 %s'% ip_address
    p = os.system(cmds)
    if p == 0:
        print("ip_address"+"连通正常\n")
    else:
        print("ip_address"+"连通失败\n")

if __name__ == '__main__':

    ip_add=[
"       10.222.46.2     "       ,
"       10.222.46.107   "       ,
"       10.222.46.163   "       ,
"       10.222.46.146   "       ,
"       10.222.46.89    "       ,
"       10.222.46.91    "       ,
"       10.222.46.247   "       ,
"       10.222.46.130   "       ,
"       10.222.46.143   "       ,
"       10.222.48.112   "       ,
"       10.222.49.16    "       ,
"       10.222.51.100   "       ,
"       10.222.48.237   "       ,
"       10.222.49.154   "       ,
"       10.222.49.143   "       ,
"       10.222.49.114   "       ,
"       10.222.49.84    "       ,
"       10.222.54.148   "       ,
"       10.222.55.134   "       ,
"       10.222.55.114   "       ,
"       10.222.53.205   "       ,
"       10.222.55.66    "       ,
"       10.222.55.245   "       ,
"       10.222.55.28    "       ,
"       10.222.92.84    "       ,
"       10.222.92.172   "       ,
"       10.222.55.196   "
]

    start_time = time.time()
    for i in ip_add:
        func(i)
    end_time=time.time()
    print("time:",end_time-start_time)
